home *** CD-ROM | disk | FTP | other *** search
/ Champak 132 (Alt) / Vol 132.iso / games / crazy_ch.swf / scripts / frame_3 / DoAction_5.as < prev    next >
Encoding:
Text File  |  2011-06-09  |  4.4 KB  |  169 lines

  1. function wall_move()
  2. {
  3.    heli._x = aim._x;
  4.    helibeenhit();
  5.    checkhitHos();
  6.    _root.score.text = _root.score_num;
  7.    _root.change1.text = _root.change11;
  8.    _root.ammo_txt.text = _root.ammo;
  9.    clouds._x -= 1;
  10.    if(clouds._x < 270)
  11.    {
  12.       clouds._x = 400;
  13.    }
  14.    var _loc2_ = 0;
  15.    while(_loc2_ < explode_ar.length)
  16.    {
  17.       explode_ar[_loc2_]._x -= 5;
  18.       _loc2_ = _loc2_ + 1;
  19.    }
  20.    _loc2_ = 0;
  21.    while(_loc2_ < wall_ar.length)
  22.    {
  23.       wall_ar[_loc2_]._x -= 5;
  24.       if(wall_ar[_loc2_]._x <= -22)
  25.       {
  26.          wall_ar[_loc2_]._x = 702;
  27.          wall_ar[_loc2_]._y = y_ss;
  28.          upOrDown = random(2);
  29.          if(upOrDown == 0 && y_ss > 540)
  30.          {
  31.             y_ss -= 3;
  32.          }
  33.          else if(upOrDown == 1 && y_ss < 640)
  34.          {
  35.             y_ss += 3;
  36.          }
  37.          if(wall_ar[_loc2_] == wall_ar[5])
  38.          {
  39.             upOrDown = random(2);
  40.             if(upOrDown == 0 && y_ss > 500)
  41.             {
  42.                y_ss -= 50;
  43.             }
  44.             else if(upOrDown == 1 && y_ss < 660)
  45.             {
  46.                y_ss += 50;
  47.             }
  48.          }
  49.       }
  50.       wall_ar_up[_loc2_]._x = wall_ar[_loc2_]._x;
  51.       wall_ar_up[_loc2_]._y = wall_ar[_loc2_]._y - 630;
  52.       _loc2_ = _loc2_ + 1;
  53.    }
  54.    _loc2_ = 0;
  55.    while(_loc2_ < obs_ar.length)
  56.    {
  57.       obs_ar[_loc2_]._x -= 5;
  58.       if(obs_ar[_loc2_]._x <= -300)
  59.       {
  60.          removeMovieClip(obs_ar[_loc2_]);
  61.       }
  62.       _loc2_ = _loc2_ + 1;
  63.    }
  64.    var _loc3_ = 0;
  65.    while(_loc3_ < hos_ar.length)
  66.    {
  67.       hos_ar[_loc3_]._y += hos_ar[_loc3_].speed;
  68.       hos_ar[_loc3_]._x -= 5;
  69.       if(hos_ar[_loc3_]._x <= -100)
  70.       {
  71.          removeMovieClip(hos_ar[_loc3_]);
  72.          _loc2_ = 0;
  73.          while(_loc2_ < obs_ar.length)
  74.          {
  75.             if(hos_ar[_loc3_]._x + 54 > obs_ar[_loc2_]._x - obs_ar[_loc2_]._width / 2 && hos_ar[_loc3_]._x - 54 < obs_ar[_loc2_]._x + obs_ar[_loc2_]._width / 2 && hos_ar[_loc3_]._y + 10 > obs_ar[_loc2_]._y - obs_ar[_loc2_]._height / 2 && hos_ar[_loc3_]._y - 10 < obs_ar[_loc2_]._y + obs_ar[_loc2_]._height / 2)
  76.             {
  77.                hos_ar[_loc3_].ymove = 0;
  78.             }
  79.             _loc2_ = _loc2_ + 1;
  80.          }
  81.       }
  82.       _loc3_ = _loc3_ + 1;
  83.    }
  84.    updateAfterEvent();
  85. }
  86. function createObs()
  87. {
  88.    var _loc1_ = attachMovie("wall_obst","obs" + num_obs,num_obs);
  89.    num_obs++;
  90.    _loc1_._x = 720;
  91.    upOrDownforx = random(300) + 120;
  92.    coll(_loc1_,re_w,gr_w,bl_w);
  93.    _loc1_._y = y_ss - upOrDownforx;
  94.    obs_ar[num_obs] = _loc1_;
  95.    if(num_obs >= 10)
  96.    {
  97.       num_obs = 0;
  98.    }
  99. }
  100. function createHos()
  101. {
  102.    var _loc1_ = attachMovie("man","man" + num_hos,num_hos);
  103.    num_hos++;
  104.    _loc1_._x = 720;
  105.    _loc1_._y = y_ss - 500;
  106.    hos_ar[num_hos] = _loc1_;
  107.    if(num_hos >= 20)
  108.    {
  109.       num_hos = 10;
  110.    }
  111. }
  112. function give_score()
  113. {
  114.    score_num += 1;
  115.    change11++;
  116.    if(change11 >= 600)
  117.    {
  118.       change11 = 0;
  119.       re_w = random(101);
  120.       gr_w = random(101);
  121.       bl_w = random(101);
  122.       var _loc1_ = 0;
  123.       while(_loc1_ < wall_ar.length)
  124.       {
  125.          coll(wall_ar[_loc1_],re_w,gr_w,bl_w);
  126.          _loc1_ = _loc1_ + 1;
  127.       }
  128.       _loc1_ = 0;
  129.       while(_loc1_ < wall_ar_up.length)
  130.       {
  131.          coll(wall_ar_up[_loc1_],re_w,gr_w,bl_w);
  132.          _loc1_ = _loc1_ + 1;
  133.       }
  134.       coll(clouds,gr_w + 50,bl_w + 30,re_w + 30);
  135.    }
  136. }
  137. clearInterval(inter_wall);
  138. clearInterval(inter_obs);
  139. clearInterval(inter_hostage);
  140. var change11 = 0;
  141. var inter_score;
  142. var inter_wall;
  143. var inter_hostage;
  144. var inter_obs;
  145. var hos_ar = new Array();
  146. var obs_ar = new Array();
  147. var wall_ar = new Array(wall0,wall1,wall2,wall3,wall4,wall5,wall6,wall7,wall8,wall9,wall10,wall11,wall12,wall13,wall14,wall15,wall16,wall17,wall18,wall19);
  148. var wall_ar_up = new Array(wall0a,wall1a,wall2a,wall3a,wall4a,wall5a,wall6a,wall7a,wall8a,wall9a,wall10a,wall11a,wall12a,wall13a,wall14a,wall15a,wall16a,wall17a,wall18a,wall19a);
  149. inter_wall = setInterval(wall_move,0.02);
  150. var num_obs = 1;
  151. var num_hos = 11;
  152. createObs();
  153. inter_obs = setInterval(createObs,2400);
  154. inter_hostage = setInterval(createHos,1700);
  155. inter_score = setInterval(give_score,50);
  156. var i = 0;
  157. while(i < wall_ar.length)
  158. {
  159.    coll(wall_ar[i],re_w,gr_w,bl_w);
  160.    i++;
  161. }
  162. var i = 0;
  163. while(i < wall_ar_up.length)
  164. {
  165.    coll(wall_ar_up[i],re_w,gr_w,bl_w);
  166.    i++;
  167. }
  168. coll(clouds,gr_w + 50,bl_w + 30,re_w + 30);
  169.